package com.lin.controller.home;

/**
 * @author Created by Lin Weihong
 * @date on 2022/4/14 20:27
 * 主页的内容
 */

import com.lin.base.Result;
import com.lin.entity.News;
import com.lin.service.NewsService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/api/home")
public class NewsController {

    @Resource
    NewsService newsService;

    @GetMapping("/news")
    public Result getHotNews() {
        List<News> hotNews = newsService.findHotNews();
        return Result.ok(hotNews,"查询成功");
    }

}
